package com.kfm.am;

import java.util.Scanner;

public class Exec03 {

    public static void main(String[] args) {
        // 编写一个程序，去除字符串中的重复字符。
        // 例如：输入`asdfgnasd`，输出`asdfgn`
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一个字符串：");
        String str = sc.next();
        String letter = deleteRepeatLetter(str);
        System.out.println(letter);
    }

    public static String deleteRepeatLetter(String str) {
        str = str.replace(" ", "");
        String str1 = "";
        for (int i = 0; i < str.length(); i++) {
            char c = str.charAt(i);
            if (str1.indexOf(c) == -1) {
                str1 += c;
            }
        }
        return str1;
    }
}
